import { ArrayMaxSize, ArrayMinSize, IsArray, IsNotEmpty, IsNumber, IsOptional, IsString, Max, MaxLength, Min } from "class-validator";

class CommonDto {
    @MaxLength(10, {message : '角色名长度不能超过10个字符'})
    @IsNotEmpty({message : '请填写角色名'})
    @IsString({message : '数据非法'})
    name:string;

    @IsArray({message : '数据非法'})
    @IsOptional()
    menus : number[]

    @IsArray({message : '数据非法'})
    @IsOptional()
    rules : number[]

    @MaxLength(30, {message : '备注长度不能超过30个字符'})
    @IsString({message : '数据非法'})
    @IsOptional()
    remark:string;
}

export class AddRoleDto extends CommonDto {
    
}

export class EditRoleDto extends CommonDto {
    
}

export class DeleteRoleDto {
    @ArrayMinSize(1, {message : '数据非法'})
    @IsArray({message : '数据非法'})
    ids : number[]
}